function check_email(input){
	var email = input.value;
	if(valid_email(email)){
		$("#sign-btn").removeClass("disabled");
		$("#email-cg").removeClass("error");
		$("#email-cg").addClass("success");
		$("#email-hint").html("");
		$("#sign-btn").click(sign_in);
	}else{
		$("#sign-btn").addClass("disabled");
		$("#email-cg").removeClass("success");
		$("#email-cg").addClass("error");
		$("#email-hint").html("incorrect email address");
		$("#sign-btn").unbind("click");
	}
}

function sign_in(){
	var psw = $("#password")[0].value;
	var email = $("#email")[0].value;
	
	$.post('/MyMicroBlog/index.php/user/login',{
			email:email,
			password:psw,
		},
		function(data, textStatus, jqXHR){
			if(data=="pass"){
				window.location.href="..";
			}else{
				$("#login-wrong-hint").removeClass("hide");
			}
		});
}